<template>
	<el-table ref="multipleTable" :data="tableData" tooltip-effect="dark" class="table">
		<el-table-column label="标题" prop="title" align="center"> </el-table-column>
		<el-table-column prop="label_name" label="标签名称" width="86"> </el-table-column>
		<el-table-column label="状态" width="100" align="center">
			<template slot-scope="scope">
				<el-tag size="medium" class="tag_label" effect="dark" :type="scope.row.state ? 'success' : 'info'">
					{{ scope.row.state | filterState }}
				</el-tag>
			</template>
		</el-table-column>
		<el-table-column label="允许评论" width="100" align="center">
			<template slot-scope="scope">
				<el-tag size="medium" style="border-radius: 14px" effect="dark" :type="scope.row.is_answer ? 'success' : 'info'">{{
					scope.row.is_answer | filterIs_answer
				}}</el-tag>
			</template>
		</el-table-column>
		<el-table-column prop="photo" label="员工" align="center">
			<template slot-scope="scope">
				<div class="staff">
					<el-avatar :src="scope.row.photo" size="medium"></el-avatar>
					<span>{{ scope.row.nickname }}</span>
				</div>
			</template>
		</el-table-column>
		<el-table-column prop="createtime" label="发布时间" width="160" align="center">
			<template slot-scope="scope"
				><span class="time">{{ scope.row.createtime | filterCreatetime }}</span></template
			>
		</el-table-column>
		<el-table-column prop="order" label="排序" align="center"> </el-table-column>
		<el-table-column label="操作" align="center">
			<template slot-scope="scope">
				<el-button type="danger" size="mini" class="btn" @click="del(scope.row.id)" plain>删除</el-button>
			</template>
		</el-table-column>
	</el-table>
</template>

<script>
export default {
	props: ['tableData', 'options', 'type'],
	methods: {
		async del(id) {
            await this.$confirm('确定删除该数据?', '提示', { type: 'warning' });
			this.$emit('del', id);
		},
	},
};
</script>

<style >
.table {
	padding-top: 20px;
}

.tag_label {
	border-radius: 14px;
}
.cell{
/* 强制一行显示*/
 white-space: nowrap !important;
 /* 溢出隐藏 */
 overflow: hidden !important;
/* 溢出部分变成... */
text-overflow: ellipsis !important;
}
</style>
